23 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
24 #define For(i, a, b) for (int i=(a); i<(b); ++i)
25 #define D(x) cout << #x " is " << x << endl
29 vector
<pair
<int, int> > g
[MAXN
];
34 while (cin
>> n
>> m
&& n
){
36 for (int i
=0; i
<n
; ++i
) g
[i
].clear();
38 int si
, ni
, a
, b
, c
; string op
;
39 cin
>> si
>> ni
>> op
>> c
;
43 g
[b
].push_back(make_pair(a
, c
-1));
45 g
[a
].push_back(make_pair(b
, -c
-1));
50 for (int i
=0; i
<n
; ++i
) g
[dummy
].push_back(make_pair(i
, 0));
52 fill(d
, d
+n
, INT_MAX
/ 3);
54 for (int repeat
= true, cota
= n
; repeat
&& --cota
; ){
56 for (int u
=0; u
<n
; ++u
){
57 for (int k
=0; k
<g
[u
].size(); ++k
){
58 int v
= g
[u
][k
].first
, w
= g
[u
][k
].second
;
68 for (int u
=0; u
<n
; ++u
){
69 for (int k
=0; k
<g
[u
].size(); ++k
){
70 int v
= g
[u
][k
].first
, w
= g
[u
][k
].second
;
73 u
= n
; break; //ultrabreak
78 if (solvable
) puts("lamentable kingdom");
79 else puts("successful conspiracy");